﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace linkDATABASE.扩展
{
    public partial class 模糊查询房型 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string xing = TextBox1.Text;

            string Sqlstr = "SELECT  [房号], [预订状态], [房形] as 房型, [房态], [床位数], [所处位置]" +
                " FROM Roominfo WHERE 房形 LIKE '" + xing+"%'";
            SqlDataSource1.SelectCommand = Sqlstr;
            SqlDataSource1.DataBind();
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            string hao = TextBox2.Text;
            string sqlstr = "DELETE FROM Roominfo WHERE 房号 = "+hao;

            SqlDataSource1.DeleteCommand = sqlstr;
            string hangshu = SqlDataSource1.Delete().ToString();

            SqlDataSource1.DataBind();

            TextBox2.Text = "";
            Label1.Text = "删除房间 "+hao+" ,"+hangshu+"行受影响";
        }

    }
}